home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIPT.PAK / EXSCR.SPP < prev    next >
Text File  |  1997-05-06  |  2KB  |  50 lines

  1. //--------------------------------------------------------------------------
  2. // Object Scripting
  3. // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
  4. //
  5. // EXSCR.SPP: Example Scripts Installation. 
  6. //--------------------------------------------------------------------------
  7. import scriptEngine;
  8. import IDE;
  9.  
  10. //#define HKEY_LOCAL_MACHINE          (0x80000002)
  11. #define HKEY_CURRENT_USER           (0x80000001)
  12.  
  13. #define KEYPATH     "Software\\Borland\\Borland C++\\5.0\\Scripting"
  14. #define VALUE_NAME  "InstallExamples"
  15.  
  16. #define MENU_TEXT    "S&cript|Install/Uninstall &examples"
  17. #define MENU_DESCR   "Install/Uninstall example scripts"
  18.  
  19. exscr(){
  20.    
  21.    // Add menu item for example script installation/uninstallation.
  22.    //
  23.    if (!scriptEngine.IsLoaded("menuhook")) scriptEngine.Load("menuhook");
  24.    assign_to_view_menu("IDE", MENU_TEXT, "InstallUninstall();", MENU_DESCR);
  25.  
  26.    //
  27.    // Surface selected examples by loading the Script Manager example
  28.    // ( == "install" examples) if registry flag is set.
  29.    // 
  30.    if (GetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME) == "1"){
  31.       sppman();
  32.    }
  33. }
  34.  
  35. InstallUninstall(){
  36.  
  37.    // Check current state of installation and toggle.
  38.    //
  39.    if (GetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME) == "1"){
  40.       SetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME, "0");
  41.       IDE.Message("Restart BCW to complete uninstallation of example scripts.");
  42.    }
  43.    else {
  44.       SetValueData(HKEY_CURRENT_USER, KEYPATH, VALUE_NAME, "1");
  45.       sppman();
  46.       IDE.Message("Example scripts installed. See README.TXT in the script examples directory.");
  47.    }
  48. }
  49.  
  50.